/**
  *@file    drv_at24cxx.h
  *@brief   AT24C256(EEPROM) driver interface
  *@anthor  zxf 2020-04-22
  *@version V1.0.0
  */
#ifndef __DRV_AT24CXX_H__
#define __DRV_AT24CXX_H__
#include "arch_if.h"

/* Exported define ----------------------------------------------------------*/

#define EE_C256                        0
#define EE_C02                         1
#define EE_C04                         0

#if EE_C256
//chip capacity
#define AT24CXX_SIZE                   0x8000 //32768

//chip page numbers
#define AT24CXX_PAGE_NUMS              512
//chip page size
#define AT24CXX_PAGE_SIZE              64
#define AT24CXX_PAGE_BORDER            0x3F
#elif EE_C04
//chip capacity
#define AT24CXX_SIZE                   512

//chip page numbers
#define AT24CXX_PAGE_NUMS              32
//chip page size
#define AT24CXX_PAGE_SIZE              16
#define AT24CXX_PAGE_BORDER            15
#elif EE_C02
//chip capacity
#define AT24CXX_SIZE                   256

//chip page numbers
#define AT24CXX_PAGE_NUMS              32
//chip page size
#define AT24CXX_PAGE_SIZE              8
#define AT24CXX_PAGE_BORDER            7
#endif



/* Exported typedef ---------------------------------------------------------*/
/* Exported functions -------------------------------------------------------*/

void drvAt24cxx_Init(void);
u8 drvAt24cxx_Write(u16 addr, u8 *buff, u16 len);
u8 drvAt24cxx_Read(u16 addr, u8 *buff, u16 len);

#endif

